#ifndef _SM3_TEST_H_
#define _SM3_TEST_H_

struct hash_testvec {
	const char *plaintext;
	const char *digest;
	unsigned int psize;
};

struct hmac_testvec {
	const char *key;
	const char *plaintext;
	const char *digest;
	unsigned int ksize;
	unsigned int psize;
};

static const struct hash_testvec sm3_tv_template[] = {
	{ .plaintext = "",
	  .psize = 0,
	  .digest = (u8 *)(u8[]){ 0x1A, 0xB2, 0x1D, 0x83, 0x55, 0xCF, 0xA1,
				  0x7F, 0x8e, 0x61, 0x19, 0x48, 0x31, 0xE8,
				  0x1A, 0x8F, 0x22, 0xBE, 0xC8, 0xC7, 0x28,
				  0xFE, 0xFB, 0x74, 0x7E, 0xD0, 0x35, 0xEB,
				  0x50, 0x82, 0xAA, 0x2B } },
	{ .plaintext = "a",
	  .psize = 1,
	  .digest = (u8 *)(u8[]){ 0x62, 0x34, 0x76, 0xAC, 0x18, 0xF6, 0x5A,
				  0x29, 0x09, 0xE4, 0x3C, 0x7F, 0xEC, 0x61,
				  0xB4, 0x9C, 0x7E, 0x76, 0x4A, 0x91, 0xA1,
				  0x8C, 0xCB, 0x82, 0xF1, 0x91, 0x7A, 0x29,
				  0xC8, 0x6C, 0x5E, 0x88 } },
	{ /* A.1. Example 1 */
	  .plaintext = "abc",
	  .psize = 3,
	  .digest = (u8 *)(u8[]){ 0x66, 0xC7, 0xF0, 0xF4, 0x62, 0xEE, 0xED,
				  0xD9, 0xD1, 0xF2, 0xD4, 0x6B, 0xDC, 0x10,
				  0xE4, 0xE2, 0x41, 0x67, 0xC4, 0x87, 0x5C,
				  0xF2, 0xF7, 0xA2, 0x29, 0x7D, 0xA0, 0x2B,
				  0x8F, 0x4B, 0xA8, 0xE0 } },
	{ .plaintext = "abcdefghijklmnopqrstuvwxyz",
	  .psize = 26,
	  .digest = (u8 *)(u8[]){ 0xB8, 0x0F, 0xE9, 0x7A, 0x4D, 0xA2, 0x4A,
				  0xFC, 0x27, 0x75, 0x64, 0xF6, 0x6A, 0x35,
				  0x9E, 0xF4, 0x40, 0x46, 0x2A, 0xD2, 0x8D,
				  0xCC, 0x6D, 0x63, 0xAD, 0xB2, 0x4D, 0x5C,
				  0x20, 0xA6, 0x15, 0x95 } },
	{ /* A.1. Example 2 */
	  .plaintext = "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdab"
		       "cdabcdabcdabcdabcd",
	  .psize = 64,
	  .digest = (u8 *)(u8[]){ 0xDE, 0xBE, 0x9F, 0xF9, 0x22, 0x75, 0xB8,
				  0xA1, 0x38, 0x60, 0x48, 0x89, 0xC1, 0x8E,
				  0x5A, 0x4D, 0x6F, 0xDB, 0x70, 0xE5, 0x38,
				  0x7E, 0x57, 0x65, 0x29, 0x3D, 0xCB, 0xA3,
				  0x9C, 0x0C, 0x57, 0x32 } },
	{ .plaintext = "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
		       "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
		       "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
		       "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
		       "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
		       "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
		       "abcdabcdabcdabcdabcdabcdabcdabcd",
	  .psize = 256,
	  .digest = (u8 *)(u8[]){ 0xB9, 0x65, 0x76, 0x4C, 0x8B, 0xEB, 0xB0,
				  0x91, 0xC7, 0x60, 0x2B, 0x74, 0xAF, 0xD3,
				  0x4E, 0xEF, 0xB5, 0x31, 0xDC, 0xCB, 0x4E,
				  0x00, 0x76, 0xD9, 0xB7, 0xCD, 0x81, 0x31,
				  0x99, 0xB4, 0x59, 0x71 } }
};

static const struct hmac_testvec hmac_sm3_tv_template[] = {
	{
		.key = "\x01\x02\x03\x04\x05\x06\x07\x08"
		       "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
		       "\x11\x12\x13\x14\x15\x16\x17\x18"
		       "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20",
		.ksize = 32,
		.plaintext =
			"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
			"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
		.psize = 112,
		.digest = "\xca\x05\xe1\x44\xed\x05\xd1\x85"
			  "\x78\x40\xd1\xf3\x18\xa4\xa8\x66"
			  "\x9e\x55\x9f\xc8\x39\x1f\x41\x44"
			  "\x85\xbf\xdf\x7b\xb4\x08\x96\x3a",
	},
	{
		.key = "\x01\x02\x03\x04\x05\x06\x07\x08"
		       "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
		       "\x11\x12\x13\x14\x15\x16\x17\x18"
		       "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
		       "\x21\x22\x23\x24\x25",
		.ksize = 37,
		.plaintext =
			"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
			"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
			"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
			"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
		.psize = 50,
		.digest = "\x22\x0b\xf5\x79\xde\xd5\x55\x39"
			  "\x3f\x01\x59\xf6\x6c\x99\x87\x78"
			  "\x22\xa3\xec\xf6\x10\xd1\x55\x21"
			  "\x54\xb4\x1d\x44\xb9\x4d\xb3\xae",
	},
	{
		.key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
		       "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
		       "\x0b\x0b\x0b\x0b\x0b\x0b",
		.ksize = 32,
		.plaintext = "Hi There",
		.psize = 8,
		.digest = "\xc0\xba\x18\xc6\x8b\x90\xc8\x8b"
			  "\xc0\x7d\xe7\x94\xbf\xc7\xd2\xc8"
			  "\xd1\x9e\xc3\x1e\xd8\x77\x3b\xc2"
			  "\xb3\x90\xc9\x60\x4e\x0b\xe1\x1e",
	},
	{
		.key = "Jefe",
		.ksize = 4,
		.plaintext = "what do ya want for nothing?",
		.psize = 28,
		.digest = "\x2e\x87\xf1\xd1\x68\x62\xe6\xd9"
			  "\x64\xb5\x0a\x52\x00\xbf\x2b\x10"
			  "\xb7\x64\xfa\xa9\x68\x0a\x29\x6a"
			  "\x24\x05\xf2\x4b\xec\x39\xf8\x82",
	},
};
#endif
